package com.xzm.springboot.controller;

import com.xzm.springboot.bean.Employee;
import com.xzm.springboot.mapper.EmpMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 3052
 * @create 2020-08-10 14:58
 */
@RestController
public class EmpController {

    @Autowired
    EmpMapper empMapper;

    @RequestMapping("/emp/{id}")
    public Employee getEmpById(@PathVariable("id") Integer id){
        Employee employee = empMapper.getEmpById(id);
        return employee;
    }

    @RequestMapping("/emp")
    public Employee insertEmp(Employee employee){
        empMapper.insertEmp(employee);
        return employee;
    }
}
